package com.springbootorder.feignservice.impl;

import com.springbootorder.entity.User;
import com.springbootorder.feignservice.HelloFeignService;
import com.springbootorder.service.HelloService;
//import com.codingapi.txlcn.tc.annotation.DTXPropagation;
//import com.codingapi.txlcn.tc.annotation.LcnTransaction;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/hello")
public class HelloFeignServiceImpl implements HelloFeignService {
    @Autowired
    HelloService helloService;

    @Override
    @GetMapping("/hello")//@RequestParam(name ="name",required = false)
    public String sayHello(@RequestParam(name ="name",required = false) String name){
        return helloService.sayHello(name);
    }
    @Override
    @GetMapping("/test")
    public List<User> test(){
        return  helloService.list();
    }
    @Override
    @PostMapping("save")
    public void save(@RequestBody User user){
        helloService.save(user);
    }
    @Override
    @GetMapping("update")
    public void update(){
        helloService.update();
    }
}
